
/**
 * 1、从本质上讲所有的变量都是用来存储数据的
 * 2、使用 == 运算符比较两个变量时，实际上是比较这两个变量中存储的值 (不管你存的是什么值)
 * 3、使用 == 运算符比较两个引用变量时，仅比较两个引用变量中存储的值 ( 与引用变量所指向的对象无关 )
 */
public class Duck {

    public static void main(String[] args) {

        int[] first = null ;
        int[] second = null ;
        int[] third = null ;

        System.out.println( first == second ); // true 
        System.out.println( second == third ); // true

        first = new int[] { 1 , 3 , 5 , 7 , 9 };
        second = new int[] { 1 , 3 , 5 , 7 , 9 };
        System.out.println( first == second );  // false
        System.out.println( "first : " + System.identityHashCode( first ) );
        System.out.println( "second : " + System.identityHashCode( second ) );

        third = second ; 
        System.out.println( second == third ); // true
        System.out.println( "second : " + System.identityHashCode( second ) );
        System.out.println( "third : " + System.identityHashCode( third ) );

        third[ 1 ] = 33 ;
        System.out.println( second[ 1 ] );
        
    }

}
